#ifndef _GAME_MANAGER_H_
#define _GAME_MANAGER_H_

#include "SceneObject.hpp"
#include "BattleField.hpp"
#include "Tower.hpp"
#include "Camera.hpp"
#include "Bullet.hpp"
#include "Minion.hpp"
#include <vector>

#include "siut/simd/Vec3f.hpp"
using siut::simd::Vec3f;


class GameManager : public SceneObject
{
	public:
		GameManager();
		~GameManager();
    
    boost::shared_ptr<Camera> getCam();
	boost::shared_ptr<BattleField> GameManager::getBattleField();
	void placeTower();
	void spawnMinion();
	void minionReachedBaseEvent();

  protected:
    virtual void privateInit();
	virtual void privateRender();
	virtual void privateUpdate();

	private:
	void drawMinionPath();
	void makeWaypointPath();
	void makeBullet(const Vec3f& bulletDir, const Vec3f& towerPos);

    boost::shared_ptr<BattleField> bf_;
	std::vector< boost::shared_ptr<Minion> >minions_;
	std::vector< boost::shared_ptr<Tower> >towers_;
	std::vector< boost::shared_ptr<Bullet> >bullets_;
    boost::shared_ptr<Camera> cam_;

	std::vector< std::pair<int,int> > waypointTiles_;
	std::vector< boost::shared_ptr<Vec3f> > waypointsReal_;

	double gamePlayTime_; // count seconds we've been playing.
	double minionSpawnRate_; // how often to release new minion?
	double minionSpawnCountdown_;

	int minionsKilled_;
	int lives_;


};

#endif //_GAME_MANAGER_H_